package org.liushui.mycommons.android.util;

import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;

public class McApkUtil {

	public static int getVersionCode(Context context) {
		int code = 0;
		try {
			code = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		return code;
	}

	public static String getVersionName(Context context) {
		String versionName = null;
		try {
			versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		return versionName;
	}
}